package io;

import java.io.*;

//对象流java.io.ObjectOutputStream和java.io.ObjectInputDtream
//对象流是一对高级流，可以方便读写任何Java对象
public class OOSDemo  {
    public static void main(String[] args) throws IOException {


        /*1.将Person对象转换为一组字节
         * 2.将这组字节写入到文件中*/
        String name = "yuerong";
        int age = 24;
        String gender = "女";
        String[] otherInfo = {"大家好我叫岳荣"};
        Person p = new Person(name, age, gender, otherInfo);

        FileOutputStream fos = new FileOutputStream("./person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);

        oos.writeObject(p);
        System.out.println("写出完毕");

        oos.close();
    }
}